/*
 * @Author: lusx 
 * @Date: 2019-10-25 16:12:54 
 * @Last Modified by: lusx
 * @Last Modified time: 2019-10-25 17:31:46
 */

const openHref = (href) => {
  if (window.em && (typeof window.em.checkJsApi === 'function') && window.em.checkJsApi('openLink')) {
    window.em.openLink({
      url: href,
      openType: 2
    });
  } else {
    window.open(href);
  }
}

const openAppLink = (linkid, linkType) => {
  // 新地址
  //http://192.168.7.224:8081/spa/document/static4mobile/index.html#/news/12/doc/12558
  //http://localhost:9000/spa/document/static4mobile/index.html#/doc/8838&requestid=0&desrequestid=0
  //http://192.168.7.224:8082/spa/document/index.jsp?id=8838&requestid=0&desrequestid=0&router=1#/main/document/detail?_key=7dil6j
  if (Number(linkType) === 7) {
    window.openFullWindowHaveBar
      ? window.openFullWindowHaveBar(
      `/spa/document/index.jsp?id=${linkid}&router=1#/main/document/detail`
      )
      : openHref(
      `/spa/document/static4mobile/index.html#/doc/${linkid}`
      );
  } 
  return false;
};
export default openAppLink;